package com.xy.job.sample.springboot.job;

import com.xy.job.executor.core.job.IJobHandler;
import com.xy.job.executor.core.job.JobContext;
import com.xy.job.executor.core.job.JobResult;
import com.xy.job.executor.log.LoggerFactory;
import com.xy.job.executor.log.logger.Logger;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

@Component
public class SpringbootJob implements IJobHandler {

    private final Logger log = LoggerFactory.getLogger(SpringbootJob.class);

    @NotNull
    @Override
    public JobResult handle(@NotNull JobContext jobContext) throws InterruptedException {
        log.info("SpringbootJob execute start");
        TimeUnit.SECONDS.sleep(10);
        log.info("SpringbootJob execute success");
        return JobResult.success();
    }
}
